package material.command.undo;

public class CeilingFan {
    /**
     * 档位的转速
     **/
    public static final Integer HIGH = 3;
    public static final Integer MEDIUM = 2;
    public static final Integer LOW = 1;
    public static final Integer OFF = 0;
    private String location;//风扇的位置（比如卧室，客厅等）
    private Integer speed;//风扇当前的转速

    public CeilingFan(String location) {
        this.location = location;
        speed = OFF;
    }

    /**
     * 设置高转速
     */
    public void setHigh() {
        speed = HIGH;
        System.out.println(location + " 风扇档位调节至高速");
    }

    /**
     * 设置中等转速
     */
    public void setMedium() {
        speed = MEDIUM;
        System.out.println(location + " 风扇档位调节至中速");
    }

    /**
     * 设置低转速
     */
    public void setLow() {
        speed = HIGH;
        System.out.println(location + " 风扇档位调节至低速");
    }

    /**
     * 关闭风扇
     */
    public void setOff() {
        speed = OFF;
        System.out.println(location + " 风扇关闭");
    }

    /**
     * 获取当前转速
     *
     * @return
     */
    public Integer getSpeed() {
        System.out.println(location + " 风扇转速为：" + speed);
        return this.speed;
    }
}
